package com.hehua.web.decorator.demo2;

public class OrderPriceDecorator extends OrderPriceCalculator {

    protected OrderPriceCalculator orderPriceCalculator;

    public void setOrderPriceCalculator(OrderPriceCalculator orderPriceCalculator) {
        this.orderPriceCalculator = orderPriceCalculator;
    }

    @Override
    protected double calculatePrice(double basePrice) {
        if (null != orderPriceCalculator) {
            return orderPriceCalculator.calculatePrice(basePrice);
        }
        throw new RuntimeException("装饰对象为空");
    }
}
